package parameterTraining;

public class TrainObjectiveFunction {

	//suppose score(s) = lambda1 * s.logP + lambda2 * s.Google
	//get a best parameter
	public static void trainWithLogPandGoogle(ObjectiveFunction function) throws Exception{
		
		double bestBleu =0;
		double bestLambda1 = -1;
		
		for(double lambda1 =0.8; lambda1<1; lambda1+=0.05){
			double functionValue = function.getValue(new double[]{lambda1,1-lambda1});
			
			System.out.println();
			System.out.println("logP: "+lambda1);
			System.out.println("Bleu: "+functionValue);
			
			if(bestBleu<functionValue){
				bestBleu=functionValue;
				bestLambda1 =lambda1;
			}
		}
		
		System.out.println("=========================================");
		System.out.println("the best parameter for logP: "+bestLambda1);
		System.out.println("Bleu: "+bestBleu);
	}
	
	public static void main(String[] args) throws Exception {
		System.out.println("result is: "+new ObjectiveFunction().getValue(new double[]{0.8,0.2}));
		//trainWithLogPandGoogle(new ObjectiveFunction());
	}
}
